<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>搜索</title>

		<style type="text/css">
			.search_top{
				margin-top: 15px;
			}
			.search_top span{
				float:right;
				margin-right: 20%;
				font-size: 15px;
				color: #5b5b5b;
			}
			.search_top input{
				border: 1px #E1E1E1 solid;
				border-radius: 24px;
				outline: none;
				text-indent: 25px;
				height: 24px;
				color: #5b5b5b;
			}
			.search_top img{
				width: 12px;
				height: 12px;
				vertical-align: middle;
				position: relative;
				left:20px;
				z-index: 99;

			}
			.search_near div{
				padding-left: 20px;
			}
			.search_near h5{
				margin: 18px;
			}
			.search_near{
				width: 90%;

			}
			.search_near label{
				font-size: 12px;
				padding: 6px 8px 6px 7px ;
				background-color: #eaeaea;
				margin: 10px 3px ;
				border-radius: 20px;
				text-align: center;
				color: #5b5b5b;
				display: inline-block;
			}

		</style>
	</head>
	<body>
		<div class="search_top"> <img src="img/home/s.png" alt=""><input type="text" id="seacher_title_key"> <span  class="seachbtn" >搜索</span></div>
		<div  class="search_near_near"  >
		<div class="search_near" data-if="neardata.length" style="display: none" >
				<h5>最近搜索</h5>
			<div data-for="neardata" >
				<label data-id="{{id}}"  type="{{type}}"  > {{name}} </label>

			</div>
		</div>
		</div>

		<div  class="search_near  search_near_teacher"  >
				<h5>热门大师</h5>
				<div data-for="data" data-if="data.length" style="display: none">
					<label   data-id="{{id}}"  type="1">{{nickname}}</label>

				</div>
			
		</div>



			<div  class="search_near search_near_hot">
					<h5>测试方式</h5>
					<div data-for="data" data-if="data.length" style="display: none">
						<label  data-id="{{id}}"  type="2">  {{title}}

						</label>

					</div>

			</div>


		
		<script type="text/javascript">
			
			$('body').on('click', '.search_near>div>label' ,function(e){
				$(".search_top input").val(  $(this).text().trim());
				server.stock.push({name:$(this).text().trim(),type:$(this).attr("type"),id:$(this)[0].dataset.id});
				seacherteacher($(this).attr("type"),$(this)[0].dataset.id);
			})

			server.loadData(".search_near_near",{neardata:server.stock.getlist()});
			//search_near_near
			server.req('wechat/service/alllist',{},function (res) {
				if(res.code==0){
					server.loadData(".search_near_hot",res);
				}
			})
			server.req('wechat/teacher/hotTeacher',{},function (res) {

				if(res.code==0){
					res.dataT = res.data;
					server.loadData(".search_near_teacher",res);
				}
			})
           function seacherteacher(type ,id) {


			   if(type==1){
				   server.loadindex('page/teacher/teacherdetail/teacherdetail','teachid='+id,true);
			   }else if(type==2){

				   server.loadindex("page/teacher/teacher","serviceId="+id,true);
			   }else{
				 //  var serviceId = server.getQueryString("serviceId");
				   console.log($(".search_top input").val())
				   server.loadindex("page/teacher/teacher","service="+	$(".search_top input").val(),true);
			   }
		   }

			$('body').on('click', '.search_top .seachbtn' ,function(e){
				server.stock.push({name:$(".search_top input").val().trim(),type:3,id:-1});
				seacherteacher();
			})

		</script>
		
	</body>
</html>
